﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _07_Panel_嵌入式窗体
{
    public partial class Frm_Loading : Form
    {
        public Frm_Loading()
        {
            InitializeComponent();

        }

        /// <summary>
        /// 定时器触发事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer1_Tick(object sender, EventArgs e)
        {
            this.panel2.Width += 10;//每次增加10个像素(进度条的值)
            this.label3.Text = "加载系统组件[" + ((int)(this.panel2.Width * 1.0 / this.panel1.Width * 100)) + "%]";
            if (this.panel2.Width >= this.panel1.Width)
            {
                this.DialogResult = DialogResult.OK;//使用ShowDialog()方法的窗体，可以通过DialogResult属性设置返回值
                this.timer1.Stop();
            }

        }
    }
}
